﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="VillageProspecting.aspx.cs" Inherits="House客户端.VillageProspecting" %>

<!DOCTYPE html>
<html>
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>小区状况勘察表</title>
    <link href="jquery-easyui-1.5.2/themes/default/easyui.css" rel="stylesheet" />
    <link href="easyui/css/wu.css" rel="stylesheet" />
    <link href="easyui/css/icon.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server"></form>
    <div>
        <table>
            <tr>
                <td>项目案名</td>
                <td>
                    <input class="easyui-textbox" type="text" required id="CaseName" style="width: 800px;" /><span id="sp1" style="color: red"></span></td>
            </tr>
            <tr>
                <td>来源</td>
                <td>
                    <select id="Cause" class="easyui-combobox" style="width: 800px;">
                        <option value="请选择来源"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>小区封闭性</td>
                <td>
                    <select id="Close" class="easyui-combobox" style="width: 800px;">
                        <option value="请选择小区封闭性"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>楼宇结构</td>
                <td>
                    <select id="Strucure" class="easyui-combobox" style="width: 800px;">
                        <option value="请选择楼宇结构"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>交通组织方式</td>
                <td>
                    <select id="Traffic" class="easyui-combobox" style="width: 800px;">
                        <option value="请选择交通组织方式"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>景观及绿化</td>
                <td>
                    <select id="Green" class="easyui-combobox" style="width: 800px;">
                        <option value="请选择景观及绿化"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>容积率</td>
                <td>
                    <select id="Volume" class="easyui-combobox" style="width: 800px;">
                        <option value="请选择容积率"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>车位状况</td>
                <td>
                    <select id="Parking" class="easyui-combobox" style="width: 800px;">
                        <option value="请选择车位状况"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>物业公司</td>
                <td>
                    <select id="Property" class="easyui-combobox" style="width: 800px;">
                        <option value="请选择物业公司"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>其他说明</td>
                <td>
                    <textarea class="easyui-textbox" required id="Explain" style="width: 800px;"></textarea><span id="sp2" style="color: red"></span></td>
            </tr>
            <tr>
                <td>勘察时间</td>
                <td>
                    <input class="easyui-textbox" required id="time" type="date" style="width: 800px;" /><span id="sp3" style="color: red"></span></td>
            </tr>
            <tr>
                <td>
                    <button onclick="funcun()">保存</button></td>
            </tr>
        </table>
    </div>
    <script src="jquery-easyui-1.5.2/jquery.min.js"></script>
    <script src="jquery-easyui-1.5.2/jquery.easyui.min.js"></script>
    <script src="jquery-easyui-1.5.2/locale/easyui-lang-zh_CN.js"></script>
    <script src="jquery-easyui-1.5.2/easyloader.js"></script>
    <script src="jquery-easyui-1.5.2/jquery.params.js"></script>
    <script src="jquery-easyui-1.5.2/Common.js"></script>
    <script>
        //绑定来源
        Cause();
        function Cause() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "房屋来源" + "&i=" + 41,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Cause").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定小区封闭性
        Close();
        function Close() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "小区封闭性" + "&i=" + 7,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Close").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定居住小区楼宇构成
        Strucure();
        function Strucure() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "居住小区楼宇构成" + "&i=" + 8,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Strucure").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定交通组织方式
        Traffic();
        function Traffic() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "交通组织方式" + "&i=" + 9,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Traffic").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定景观及绿化
        Green();
        function Green() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "景观及绿化" + "&i=" + 10,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Green").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定容积率
        Volume();
        function Volume() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "容积率" + "&i=" + 11,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Volume").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定车位状况
        Parking();
        function Parking() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "车位状况" + "&i=" + 12,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Parking").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定物业公司
        Property();
        function Property() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "物业公司" + "&i=" + 13,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Property").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        function funcun() {
            var ProjectNumber = $.query.get("ProjectNumber");
            var CaseName = $("#CaseName").val();
            if (CaseName == "" || CaseName == null) {
                $("#sp1").html("不能为空");
                return;
            } else {
                $("#sp1").html("");
            }
            var Cause = $('#Cause').combobox('getValue');
            var Close = $('#Close').combobox('getValue');
            var Strucure = $('#Strucure').combobox('getValue');
            var Traffic = $('#Traffic').combobox('getValue');
            var Green = $('#Green').combobox('getValue');
            var Volume = $('#Volume').combobox('getValue');
            var Parking = $('#Parking').combobox('getValue');
            var Property = $('#Property').combobox('getValue');
            var Explain = $("#Explain").val();
            if (Explain == "" || Explain == null) {
                $("#sp2").html("不能为空");
                return;
            } else {
                $("#sp2").html("");
            }
            var time = $("#time").val();
            if (time == "" || time == null) {
                $("#sp3").html("不能为空");
                return;
            } else {
                $("#sp3").html("");
            }
            $.ajax({
                type: "PUT",
                url: WebApiURL + "api/Values",
                data: {
                    ProjectNumber: ProjectNumber,
                    Village_Explain: Explain,
                    Village_Property: Property,
                    Village_Parking: Parking,
                    Village_Volume: Volume,
                    Village_Green: Green,
                    Village_Traffic: Traffic,
                    Village_Structure: Strucure,
                    Village_Close: Close,
                    Village_Cause: Cause,
                    Village_CaseName: CaseName
                },
                success: function (obj) {
                    if (obj > 0) {
                        $.messager.alert("保存成功");
                        location.href = 'ProspectingList.aspx';
                    }
                    else {
                        $.messager.alert("保存失败");
                        location.href = 'VillageProspecting.aspx';
                    }
                }
            })
        }
    </script>
</body>
</html>
